package com.example.musicplayer

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import android.widget.Button
import android.widget.ImageView
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.http.Url

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        if (savedInstanceState==null) {
            supportFragmentManager.beginTransaction()
                .replace(R.id.change,MusicRecommendation())
                .commit()
        }

        val MusicRecommendationBtn=findViewById<Button>(R.id.MusicRecommendationBtn)
        MusicRecommendationBtn.setOnClickListener {
            val fragmentManager=supportFragmentManager
            val transaction=fragmentManager.beginTransaction().apply {
                replace(R.id.change,MusicRecommendation())
                commit()
            }
        }

        val MusicPlayBtn=findViewById<Button>(R.id.MusicPlayBtn)
        MusicPlayBtn.setOnClickListener {
            val fragmentManager=supportFragmentManager
            val transaction=fragmentManager.beginTransaction().apply {
                replace(R.id.change,MusicPlayer())
                commit()
            }
        }

        val MusicListBtn=findViewById<Button>(R.id.MusicListBtn)
        MusicListBtn.setOnClickListener {
            val fragmentManager=supportFragmentManager
            val transaction=fragmentManager.beginTransaction().apply {
                replace(R.id.change,MusicList())
                commit()
            }
        }

    }
}